<?
	  	  include("/inc/header.html") {}
    ?>
<div class="col-lg-12">
			<div class="panel">
				<div class="form-body pal">
				<div style="padding-top: 2%; margin-right: auto; padding-bottom: 10px;">
				<label for="inputUsername" class="col-md-3 control-label">
				  <div align="right">组名称
					<span class='require' id="bianhao">*</span></div>
                                     </label>
				<div class="col-md-7">
					<div class="input-icon">
						<input id="name" type="text" class="form-control" />
						<input id="id" type="hidden" class="form-control" />
					</div>
				</div>
			</div>

			<div style="margin-right: auto; padding-bottom:10px;">
				<label for="inputUsername" class="col-md-3 control-label">
				  <div align="right">组描述
					<span class='require' id="paixu">*</span></div>
                                     </label>
				<div class="col-md-7">
					<div class="input-icon">
						<input id="description" type="text" class="form-control" />
					</div>
				</div>
			</div>
			
			<div style="margin-right: auto; padding-bottom: 54px;">
				<label for="inputUsername" class="col-md-3 control-label">
				  <div align="right">父节点
					<span class='require' id="fuji"></span></div>
                                     </label>
				<div class="col-md-7">
					<div class="input-group input-group-sm mbs" >
						 <input id="parentclassname" type="text" class="form-control" disabled="true" /> 
						 <input id="parentClassid" type="hidden" value="00" class="form-control" />
						<span class="input-group-btn"><button id="xuanze" onclick="saveclassZTree()" type="button" data-toggle="dropdown" class="btn btn-success dropdown-toggle">选择类..</button></span>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script>
var ztreeId = window.parent.getztreeId();
$(function() {
	 $.ajax({
			type : "post",
			data : {
				"id":ztreeId
			},
			url : "knowledgeEditDataRoleQueryUserGroupMessage",
			dataType : "json",
			beforeSend : function(XMLHttpRequest) {
			},
			success : function(data){
			//	alert(JSON.stringify(data));
				 $("#name").val(data[0].name);
				 $("#id").val(data[0].id);
           		 $("#description").val(data[0].description);
           		 $("#parentclassname").val(data[0].parentName);
           		 $("#parentClassid").val(data[0].parentId);
			},
		});
	});
//选择父类
		function saveclassZTree() {
		parent.layer.open({
			type : 2,
			area : [ '400px', '400px' ],
			fix : false, //不固定
			scrollbar : false,
			shadeClose : true,
			//move : false,
			title:"选择节点",
			skin : 'layui-layer-rim', //加上边框
			btn : [ '保存 ', '关闭' ],
			content : ["knowledge-edit-data-usergroup-zTree.html?winName="+window.name, 'no'],
			yes : function(index,layer) {		
			var iframeWin = parent.window[layer.find('iframe')[0]['name']];
			  			  iframeWin.save();
			},
			cancel : function(index) {
			}
		});
	}
	//保存
	function page(){
		var name=$("#name").val();
		var id=$("#id").val();
		var description=$("#description").val();
		var parentClassid=$("#parentClassid").val();
		if( name==""){
			layer.msg('请输入组名称！');
		}else if(description ==""){
			layer.msg('请输入组描述！');
		}else{ 
			 $.ajax({
					type : "post",
					data : {
						"id":id,
						"name":name,
						"description":description,
						"parentClassid":parentClassid
					},
					url : "knowledgeEditDataRoleEditUserGroup.do",
					dataType : "json",
					beforeSend : function(XMLHttpRequest) {
					},
					success : function(data){
					 var index = parent.layer.getFrameIndex(window.name); 
					 	 window.parent.initTree();
		           		 parent.layer.msg('添加或编辑成功');
		            	 parent.layer.close(index); 
					},
				});
			}
	}
</script>
